<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">

	/*  弹出div1的内容*/
	function fn1(){
		//得到div1对象
		var div1 = document.getElementById("d1");
		alert(div1.innerText);
	}
	
	
	
	
	/*  修改div2的内容为呵呵*/
	function fn2(){
		var div2 = document.getElementById("d2");
		div2.innerText="呵呵";
	}
</script>
</head>
<body>
<input type="button" value="获取div1的内容" onclick="fn1()">
<input type="button" value="修改div2的内容" onclick="fn2()">
<div id="d1">div1</div>
<div id="d2">div2</div>
<input type="text" id="i1" value="我爱你js">
</body>
</html>